home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
bbs_time.zip
/
TIMECHEK.DOC
< prev
next >
Wrap
Text File
|
1992-05-12
|
11KB
|
274 lines
TIMECHEK
a SMILEWARE :-) product of
Steve Antonoff
3917 Garfield Drive
Stone Mountain, GA 30083
1:133/302.0@fidonet, (404) 296-9681
Operates 24 hours
File Requests & Downloads not available
during FIDOnet Zone Mail Hour (09:00 - 10:00 UCT)
Updated May 12, 1992
TIMECHEK is copyright, 1987, 1990, 1992 by Steve Antonoff
and is released for public non-commercial use and distribution.
No fees, royalties, licenses are required for non-commercial use.
TIMECHEK is an outgrowth of TIME96. TIMECHEK can function
just like TIME96 (it has all of TIME96's capabilities) plus one
additional feature that makes it much easier to use. TIMECHEK
checks the system clock for the time of day, day of week, etc,
and exits with an ERRORLEVEL based on that time and the arguments
presented with the command. For version 2.0, there is no default
mode. Version 2.1 adds the "hour of day" and "minute of hour"
capabilities.
The original mode of TIME96, and the old default mode of
TIMECHEK, can be accessed by use of a /T command line parameter.
In this mode, the 24 hour day is broken into 96 fifteen minute
intervals. Thus, between midnight (00:00:00) and quarter past
(00:14:59), timechek returns an errorlevel of 1; at 6:00:00 AM,
it returns an errorlevel of 25, at noon an errorlevel of 49, etc.
Through use of this program, a batch file can do different
things based on time of day, day of week, etc. It was written to
allow different parameters to be passed to a FIDOnet mail proces-
sor based on the time.
The current version of TIMECHEK has several arguments which
affect the program's behaviour:
Q: any argument beginning with a -Q (quite) suppresses the
generation of the copyright and time of day printout;
W: any argument beginning with a -W causes TIMECHEK to return an
argument based on the DAY OF WEEK in place of the TIME OF DAY
(1=Sunday, 2=Monday, etc.);
M: any argument beginning with a -M causes timechek to return
the MONTH (Jan = 1, etc);
D: any argument beginning with a -D causes TIMECHEK to return
the day of the month (ie, 9/22/87 -> 22);
Y: any argument beginning with a -Y causes TIMECHEK to return
the year (2 digit).
H: any argument beginning with a -H causes TIMECHEK to return
the hour of the day (0-23).
:: any argument beginning with a colon (/:) causes TIMECHEK to
return the minute within the hour (0-59).
R: any argument beginning with a -R puts TIMECHEK into the RANGE
mode. The program will scan the remaining arguments and
return the number of the FIRST range that matches the current
time. Ranges are of the form
DD#DD#DD:ssss-eeee/l
where:
DD is a day of the week (enought character to make it
unique in English: SU, M, TU, W, TH, F, SA), WK (weekdays),
WN (weekends) or A (all days). Multiple days may be "or-ed"
together with #, thus M#WMF means Monday or Wednesday or
Friday. More letters than the minimum can be used, so FRIDAY
is the same thing as F.
ssss is the start time (expressed as a number between 0 and
2400). If no start time is specified, 0000 is assumed.
eeee is the end time (expressed as a number between 0 and 2400).
If no end time is specified, 2400 is assumed.
l is the errorlevel to return if this range is the match. If no
level is specified, the ordinal number of the range within
the command line is used.
With version 2.0, the structure of the range parameters is
much more flexible: the number of letters in the day of the week
parameter is flexible, the numbers of digits in the start and end
time is flexible, and the user can specify an errorlevel with the
range.
The T, M, D, W, Y, H, : and R options are mutually exclusive,
and only the LAST one entered will be in effect. These arguments
can be upper or lower case and must be preceded by a - or a /
[this is a change from TIME96, where the - and / were optional].
All of the following are legal:
timechek
The above example displays an on-line help message.
TIMECHEK /W
TIMECHEK /Q /m
TIMECHEK /Q /d
TIMECHEK /w -q
timechek -t
timechek -r al:0400-0500 al:2300-2400 al:0000-0700 ....
.... sa:0000-2400 su:0000-1700
(The last sample is too long to fit on one line in this
document, but the sa: and the su: go on the same line as the
other arguments. This basically says: if the current time
is between 0400 and 0500, return errorlevel 1, if the time
is between 2300 and 2400 return 2, if the time is between
midnight and 7am return 3, if it is Saturday (and not one of
the preceeding times) return 4 and if it is Sunday (again,
not one of the preceeding times) return 5. Thus, with one
command, a BAT file can detect National Mail Hour (errorlev-
el 1) and cheap long distance rates in the US (return levels
2-5). A errorlevel of 0 indicates higher than minimum long
distance rates and not NMH.
timechek -r A:400-500 a:2300 a:-700 sa su:-1700
This example has the same effect as the previous one but
uses a more compact format.
Example Table of return values
Day Time -T -H -W option
Sun 00:00 1 0 1
Sun 06:00 25 6 1
Sun 12:00 49 12 1
Sun 18:00 73 18 1
Sun 23:45 96 23 1
Mon 00:00 1 2
Mon 06:00 25 2
Mon 12:00 49 2
Mon 18:00 73 2
Tue 00:00 1 3
Wed 00:00 1 4
Thu 00:00 1 5
Fri 00:00 1 6
Sat 00:00 1 7
Sat 23:45 96 7
Sample use - timechek compatible runs:
timechek -w
if errorlevel 7 goto SATURDAY
if errorlevel 6 goto FRIDAY
if errorlevel 5 goto THURSDAY
if errorlevel 4 goto WEDNESDAY
if errorlevel 3 goto TUESDAY
if errorlevel 2 goto MONDAY